# -*- coding: utf-8 -*-
"""
Created on Wed Sep 26 19:30:58 2012

@author: witcher112
"""

import parse
import pickle
_DEBUG_=True
def getGlobalNamespace():
    ns=[]
    f=open("config.txt","r")
    for x in f.readlines():
        n=parse.parse(x.replace("\n",""),1)
        ns.append(n)
    f.close()
    if len(ns)==0:
        return False
    retNs=ns[0]
    for x in ns:
        retNs.merge(x,True)
    return retNs
def saveNamespace(filename,ns):
    ns=getGlobalNamespace()
    filehandler=open(filename,'w')
    pickle.dump(ns,filehandler)
    filehandler.close()
def loadNamespace(filename):
    filehandler=open(filename,'r')
    ns=pickle.load(filehandler)
    filehandler.close()
    return ns

    